# grep -n -E --color=always -H "runoo+b" test.txt
# grep -n -E --color=always -H "runo*b" test.txt
# grep -n -E --color=always -H "runo?b" test.txt
# runob
# runoobbb
# runooobbb
# runoooooob
# runoooooooooooooooooooob
# runing...

# grep -n -E --color=always -H "[59]" test.txt
# 123
# 456
# 789

# grep -n -E --color=always -H "[^abcd]" test.txt 
# grep -n -P --color=always -H '\d' test.txt       #  \d 匹配数字      \d \D是-p特有的
# grep -n -P --color=always -H '\D' test.txt       #  \D 匹配非数字
# grep -n -E --color=always -H '[0-9]' test.txt    #  [0-9] 匹配数字
# grep -n -E --color=always -H '[^0-9]' test.txt   #  [^0-9] 匹配非数字
# grep -n -P --color=always -H '\w' test.txt       #  \w 匹配字母数字下划线
# grep -n -P --color=always -H '\W' test.txt       #  \W 匹配非字母数字下划线
# grep -n -P --color=always -H '\s' test.txt       #  \s 匹配所有空格
# grep -n -P --color=always -H '\S' test.txt       #  \S 匹配所有非空格

# grep -n -E --color=always -H '[a-z]{3,5}[0-9]{3}' test.txt     #  [a-z]{3,5}[0-9]{3} 匹配3-5个字母和3个数字
# grep -n -E --color=always -H '^[a-z]{3,5}[0-9]{3}' test.txt      # ^[a-z]{3,5}[0-9]{3} 匹配3-5个字母和3个数字开头



# [[ ==支持模式匹配 或者  =~正则匹配 ]]   []是 test的简写
if [[ "01-hello.log" =~ [0-9]{2}-[a-z]+.log ]] ;then
    echo "true"
else
    echo "false"
fi
if [[ "hello.log" =~ [0-9]{2}-[a-z]+.log ]] ;then
    echo "true"
else
    echo "false"
fi

# 过滤ls列出的文件
# ls | grep -E "[a-z]+.js$"
